//
//  DCDriverTaskCell.m
//  JiuyaoMotorcade
//
//  Created by 大橙子 on 2018/12/3.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCDriverTaskCell.h"
static const int kBaseCellHeight = 30;
@interface DCDriverTaskCell ()
@property (nonatomic,strong) DCImageAndTextLabel *suvLabel;
@property (nonatomic,strong) DCImageAndTextLabel *carLabel;
@end
@implementation DCDriverTaskCell
+(instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *CellID = @"Cell";
    DCDriverTaskCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (cell == nil) {
        cell = [[DCDriverTaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = BackgroundColor;
    }
    return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpUI];
    }
    return self;
}
-(void)setUpUI
{
    [self setUpBaseUIView];
    
    self.suvLabel = [[DCImageAndTextLabel alloc]init];
    self.suvLabel.imageView.image = IMAGENAME(@"SUV");
    self.suvLabel.textLabel.textColor = BlueColor;
    self.suvLabel.textLabel.text = @"x5";
    [self.secondView addSubview:self.suvLabel];
    
    self.carLabel = [[DCImageAndTextLabel alloc]init];
    self.carLabel.imageView.image = IMAGENAME(@"car");
    self.carLabel.textLabel.textColor = BlueColor;
    self.carLabel.textLabel.text = @"x6";
    [self.secondView addSubview:self.carLabel];
    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    [self setUpLayoutSubViews];

    self.carLabel.frame = CGRectMake(self.carImageView.right+20, self.locationLabel.bottom, (self.secondView.width - self.carImageView.width-30)/2, kBaseCellHeight);
    self.suvLabel.frame = CGRectMake(self.carLabel.right, self.carLabel.y, self.carLabel.width , kBaseCellHeight);
}
-(void)setModel:(DCDriverManagerModel *)model
{
    _model = model;
    self.nameLabel.text = model.name;
    self.stateLabel.text = model.state;
    self.plateLabel.textLabel.text = Str_IsEmpty(model.plateNum)?@"未绑定车辆":model.plateNum;
    self.phoneLabel.textLabel.text = model.tel;
    self.locationLabel.textLabel.text = model.location;
    self.suvLabel.textLabel.text = [NSString stringWithFormat:@"x%@",model.suvNum];
    self.carLabel.textLabel.text = [NSString stringWithFormat:@"x%@",model.carNum];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
